package com.zmn.oms.dubbo.impl.conf.distribute.reason;

import com.zmn.common.dto2.ResponseDTO;
import com.zmn.common.utils.reflect.BeanMapper;
import com.zmn.oms.business.interfaces.conf.distributereason.ConfOrderDistributeReasonBService;
import com.zmn.oms.common.dio.conf.redistribute.reason.ConfOrderDistributeReasonDIO;
import com.zmn.oms.common.dro.conf.distribute.reason.ConfOrderDistributeReasonDRO;
import com.zmn.oms.dubbo.interfaces.conf.distribute.reason.ConfOrderDistributeReasonListRemoteService;
import com.zmn.oms.dubbo.utils.DubboConsts;
import com.zmn.oms.model.entity.conf.distributereason.ConfOrderDistributeReasonQuery;
import com.zmn.oms.model.vo.conf.distributereason.ConfOrderDistributeReasonVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;

import javax.annotation.Resource;
import java.util.List;

/**
 * 类描述: 查询改派缘由接口实现类
 *
 * @author: liudi
 * @since: 2022/07/18 10:35
 */
@Slf4j
@DubboService(loadbalance = "roundrobin", timeout = 5000, retries = 2, version = DubboConsts.INTERFACE_VERSION)
public class ConfOrderDistributeReasonListRemoteServiceImpl implements ConfOrderDistributeReasonListRemoteService {

	@Resource
	private ConfOrderDistributeReasonBService confOrderDistributeReasonBService;

	@Override
	public ResponseDTO<List<ConfOrderDistributeReasonDRO>> listByQuery(ConfOrderDistributeReasonDIO confOrderDistributeReasonDIO) {
		log.info("根据条件查询改派缘由 reasonDIO ：{}", confOrderDistributeReasonDIO);
		ConfOrderDistributeReasonQuery confOrderDistributeReasonQuery = BeanMapper.map(confOrderDistributeReasonDIO, ConfOrderDistributeReasonQuery.class);
		List<ConfOrderDistributeReasonVO> confVOList = confOrderDistributeReasonBService.listByQuery(confOrderDistributeReasonQuery);
		List<ConfOrderDistributeReasonDRO> confReasonDROList = BeanMapper.mapList(confVOList, ConfOrderDistributeReasonDRO.class);
		log.info("根据条件查询改派缘由 reasonDROList ：{}", confReasonDROList);
		return ResponseDTO.success(confReasonDROList);
	}
}
